<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>添加计划人工</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <style type="text/css">
        .detail {
            padding-right: 20px!important;
        }

        h5 {
            color: #0062CC;
        }

        .mui-navigate-right .mui-col-xs-8 {
            width: 62.666667%!important;
        }

        .mui-text-right input,
        .mui-text-right textarea {
            border: 0;
            font-size: 14px;
            font-weight: 400;
            color: #8f8f94;
            margin-bottom: 0;
            text-align: right;
        }
    </style>
</head>

<body>
    <div class="mui-content">
        <ul class="mui-table-view mui-table-view-chevron type_list_spair">
            <li class="mui-table-view-cell detail" tapmode onclick="openSaveWin('work_order_sel_tast','选择任务',{wonum: api.pageParam.wonum,linetype: api.pageParam.linetype})">
                <div class="mui-table mui-navigate-right">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">任务：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="wonum">请选择任务</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail" tapmode onclick="openSaveWin('work_order_sel_level','选工种和技能级别')">
                <div class="mui-table mui-navigate-right">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">工种：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="craft">请选择工种</span>
                    </div>
                </div>
            </li>
            <!--<li class="mui-table-view-cell detail">
				<div class="mui-table mui-navigate-right">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">技能级别：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5">请选择技能级别</span>
	                </div>
	            </div>
			</li>-->
            <li class="mui-table-view-cell detail" onclick="openSaveWin('work_order_sel_supplier','选择供应商')">
                <div class="mui-table mui-navigate-right">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">供应商：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="vendor">请选择供应商</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">数量：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="number" placeholder="请输入数量" name="" id="quantity" value="" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail" tapmode onclick="openSaveWin('work_order_sel_manager','选择人员',{manager:true})">
                <div class="mui-table mui-navigate-right">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">人工：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="laborcode">请选择人工</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">名称：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="userName"></span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">常规小时数：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="number" placeholder="请输入常规小时数" name="" id="laborhrs" value="" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">费率：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="rate"></span>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
  var isrefersh = ''
  var wonum,craft,vendor;
  apiready = function() {
      api.addEventListener({
          name: 'TastId'
      }, function(ret, err) {
      	wonum = ret.value.tastnum;
        $api.html($api.byId('wonum'), ret.value.description)
      });
      api.addEventListener({
          name: 'selLevel'
      }, function(ret, err) {
          craft = ret.value.craft
          $api.html($api.byId('craft'), ret.value.craft + '/' + ret.value.description);
          $api.text($api.byId('rate'), ret.value.standardrate);
      });
      api.addEventListener({
          name: 'selSupplier'
      }, function(ret, err) {
          vendor = ret.value.company;
          $api.html($api.byId('vendor'), ret.value.company + '/' +ret.value.companyname);
      });
      api.addEventListener({
          name: 'ManagerCh'
      }, function(ret, err) {
          $api.html($api.byId('laborcode'), ret.value.userID)
          $api.html($api.byId('userName'), ret.value.userName)
      });

      api.addEventListener({
  		    name:'navitembtn'
  		},function(ret, err){
  	    if(ret.type == 'right'){
          if(wonum == ''|| wonum == null){
            Toast('请选择任务！');
            return
          }
          if(craft == '' ||　craft ==　null){
            Toast('请选择工种！');
            return
          }
          if(vendor == '' || vendor == null){
            Toast('请选择供应商！');
            return
          }
          if(!$api.val($api.byId('quantity'))){
            Toast('请输入数量！');
            return
          }
          if($api.html($api.byId('laborcode')) == '请选择人工'){
            Toast('请选择人工！');
            return
          }
          if(!$api.val($api.byId('laborhrs'))){
            Toast('请输入常规小时数！');
            return
          }
          ajaxrd("savePlanLabor",{
            wonum: wonum,
            craft:craft,
            vendor:vendor,
            quantity:$api.val($api.byId('quantity')),
            laborcode:$api.html($api.byId('laborcode')),
            laborhrs:$api.val($api.byId('laborhrs')),
            rate:$api.text($api.byId('rate'))
          },function(data){
            Toast('添加成功');
            api.sendEvent({
                name: 'refersh',
                extra: {
                    isrefersh: 'yes'
                }
            });
            setTimeout(function(){
	    		api.closeWin();
	    	},500)
          })
  	    }
    	})
    }
</script>

</html>
